#ifndef DIALOGMEALDATAMANAGE_H
#define DIALOGMEALDATAMANAGE_H

#include <QDialog>
#include <QSqlQueryModel>
#include <QSqlQuery>
#include <QSqlDatabase>
#include <QDebug>

#include <QSqlError>
namespace Ui {
    class DialogMealDataManage;
}

class DialogMealDataManage : public QDialog
{
    Q_OBJECT

public:
    explicit DialogMealDataManage(QSqlDatabase *db, QWidget *parent = 0);
    ~DialogMealDataManage();
    void showMealData(qlonglong id);

private slots:
    void on_pushButtonSave_clicked();

    void on_pushButtonAddNew_clicked();

    void on_tableView_clicked(const QModelIndex &index);

    void on_pushButton_clicked();

    void on_lineEditSearch_textEdited(const QString &arg1);

private:
    Ui::DialogMealDataManage *ui;
    qint64 currentId;
    QSqlDatabase *m_db;
    QSqlQueryModel *m_model;
    QSqlQuery *m_query;
    QString modelQueryStr;

    void logMessage(QString msg);
};

#endif // DIALOGMEALDATAMANAGE_H
